  import java.util.Arrays;
  public class shuzu6 {//冒泡排序
        public static void main(String[] args){
            int[] nums={3,87,66,54,61,88};
            bubble(nums);
            System.out.println(Arrays.toString(nums));
        }
        public static void bubble(int[] nums){
            for (int i=0;i<nums.length-1;i++) {//外层循环控制轮数
                for(int j=0;j<nums.length-1-i;j++){//内层循环控制每轮比较的次数
                 if(nums[j]>nums[j+1]){
                    int temp=nums[j];
                    nums[j]=nums[j+1];
                    nums[j+1]=temp;
                 }
                }
            }
        }
    }
